The disclosed embodiments of the present invention relate to storing a picture in a buffer, and more particularly, to a method and apparatus for arranging pixels of a picture (e.g., a frame or a field) in storage units (e.g., memory words) each having a storage size (e.g., 128 bits) not divisible by a pixel size (e.g., 10 or 12 bits).
Because of storage and transmission limitations, there is always a desire to reduce (or compress) the pixel data amount of one picture. Since the human visual system is much more sensitive to variations in brightness than color, a video system can be optimized by devoting more bandwidth to the brightness (luma) component Y, than to the color difference (chroma) components Cb and Cr. Typically, luma pixels and chroma pixels are 8 bits per pixel in most consumer applications due to the fact that a bit depth conventionally used by many video standards is 8 bits.
In certain applications, a picture may be stored in a buffer such that the buffered picture can be used later to achieve designed functionality. For example, in a video encoder or video decoder, a reconstructed picture is stored into a frame buffer such as a dynamic random access memory (DRAM), and may be used to serve as a reference picture for motion compensation or other functions. Specifically, due to the nature of video compression and decompression, the same data structure in the frame buffer is used for writing currently decoded pixels and reading previously decoded pixels. Hence, a data arrangement of pixel data of the picture in the frame buffer may affect the efficiency of video compression and decompression.
In general, a DRAM system has a word width determined by the actual design of the DRAM system. As demand for system performance continues to increase, the DRAM word width tends to increase accordingly. For example, each data word in a DRAM which acts as a frame buffer in a video encoder or video decoder may be configured to have a 128-bit word width (i.e., a 16-byte word width). The DRAM word width M is a power-of-two value (i.e., M=2m). However, it is possible that the bit depth N of luma pixels and chroma pixels in the picture is not a power-of-two value (i.e., N≠2n). For example, with the development of the video standard, a larger bit depth (e.g., 10 bits or 12 bits) may be supported. If M is not divisible by N, how to adequately arrange the N-bit luma pixels and N-bit chroma pixels of the picture in the M-bit DRAM words of the frame buffer becomes an issue to be solved in the pertinent field.